a = input()
b = []
c = []
for i in a:
    if i == "(" or i == "[" or i == "{" or i == "<":
        b.append(i)
    if i == ")" or i == "}" or i == "]" or i == ">" and len(b) != 0:
        if b[-1] == "(" and i == ")":
            c = b.pop(-1)
        elif b[-1] == "<" and i == ">":
            c = b.pop(-1)
        elif b[-1] == "{" and i == "}":
            c = b.pop(-1)
        elif b[-1] == "[" and i == "]":
            c = b.pop(-1)
if len(b) == 0:
    print("True")
else:
    print("False")
